package com.xhh.nphm.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xhh.nphm.system.domain.KbmPointM;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface KbmPointMDao extends BaseMapper<KbmPointM> {
    @Select(" select PkId as myPkVal,KldgNo,DeptName,KldgQuestion,KldgAnswer,InputName,limitTime,OpenFlag,SortBN " +
            " from kbmPointM " +
            " where IsDel = 0 [[ and SortBC = #{sortbc}]] [[ and SortAC = #{sortac}]] " +
            " [[ and KldgQuestion =#{kldgquestion}]] [[ and InputName =#{inputname}]]" +
            " [[ and DeptName =#{deptname}]]")
    List<Map<String, Object>> kbmPointListJson(KbmPointM kbmPointM);

    @Select("select * from kbmPointM where IsDel = 0 and PkId = #{pkId}")
    KbmPointM findPointById(String pkId);

    @Update("update kbmPointM set IsDel = 1 where Pkid = #{pkId};")
    int kbmPointRemove(String pkId);

    @Select("select COUNT(1) from kbmPointM where SortBC = #{codePk};")
    int selectPointCount(String codePk);
}
